import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Creat with IntelliJ IDEA
 * Description:
 * User:WZW
 * Date:2022-09-21
 * Time:15:23
 */
public class Demo23 {
    public static void main(String[] args) {
        //使用Executors.newFixedThreadPool(10)创建出固定包含10个线程的线程池
        ExecutorService pool = Executors.newFixedThreadPool(10);
        // 通过ExecutorService.submit注册一个任务到线程池中
        pool.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("hello");
            }
        });

    }
}
